// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 获取当前的用户 GET /api/currentUser */
export async function currentUser(options?: { [key: string]: any }) {
  return request('/api/userinfo', {
    method: 'POST',
    data: { token: localStorage.getItem('token') },
    ...(options || {}),
  });
}

/** 退出登录接口 POST /api/login/outLogin */
export async function outLogin(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/loginOut', {
    method: 'POST',
    data: { token: localStorage.getItem('token') },
    ...(options || {}),
  });
}

/** 登录接口 POST /api/login/account */
export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
  return request<API.LoginResult>('/api/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 GET /api/notices */

/** 更新规则 PUT /api/rule */
export async function dyCpsInviteUser(options?: { [key: string]: any }) {
  return request<any>('/api/dyCpsInviteUser', {
    method: 'POST',
    data:{
      ...(options || {}),
    }
  });
}
export async function dyCpsFixedPassword(options?: { [key: string]: any }) {
  return request<any>('/api/dyCpsFixedPassword', {
    method: 'POST',
    data: { ...(options || {}), token: localStorage.getItem('token') },
  });
}
